module.exports = function (fn, config) {
    return new Promise((resolve, reject) => {
        config = config || {}
        config.success = res => {
            resolve(res)
        }
        config.fail = res => {
            reject(res)
        }
        fn(config)
    })
}